package com.cskaoyan;


import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * 创建日期: 2021/11/24 11:47
 *
 * @author ciggar
 */
public class JDBCDemo {


    public static void main(String[] args) throws SQLException {

        // 获取连接
        Connection connection = DBCPUtils.getConnection();

        // 获取statement对象
        Statement statement = connection.createStatement();

        // 执行SQL语句
        ResultSet resultSet = statement.executeQuery("select * from user1 where uid = 2");

        // 解析结果集
        while (resultSet.next()) {

            String name = resultSet.getString("name");

            System.out.println("name:" + name);

        }

        // 关闭资源


    }
}

